feat(mcp): NitroX Hybrid Model MCP tools (provar.nitrox.*)#112
Merged
Conversation
PR #109 added assertPathAllowed checks on input path fields (provar_home, project_path, results_path) but existing test fixtures used '..' segments that trigger PATH_TRAVERSAL before the allowedPaths.length guard. - antTools.test.ts: changed config to allowedPaths:[] and updated minimalInput() to use tmpDir-based paths (68 passing, was 26+38 fail) - automationTools.test.ts: fixed traversal test to use string concat instead of path.join (which normalises away '..' segments) - pathPolicy.test.ts: extracted typed local var to fix TS compile error that caused mocha to print help instead of running tests Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds 5 new MCP tools so AI agents can discover, read, validate, generate, and patch NitroX (Hybrid Model) .po.json component page objects for LWC, Screen Flow, Industry Components, Experience Cloud, and HTML5. Tools added: - provar.nitrox.discover: scan for Provar projects and inventory nitroX/ - provar.nitrox.read: read .po.json files for context/training - provar.nitrox.validate: validate against NX001-NX010 rules (score 0-100) - provar.nitrox.generate: generate new .po.json from component description - provar.nitrox.patch: apply RFC 7396 merge-patch to existing .po.json Also adds: - 44 unit tests in nitroXTools.test.ts covering all 5 tools - 5 smoke test entries (TOTAL_EXPECTED 33->38) - .gitignore guards for FactComponent/FactPackage schema files - QualityHub failure detection unit tests (6 new, documenting PR #110 fix) - README and docs/mcp* updates for NitroX tooling and security model Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds NitroX (Hybrid Model) support to the Provar MCP server so AI agents can discover, read, validate, generate, and patch NitroX .po.json component page objects, along with associated documentation, smoke-test coverage, and unit-test fixes.
Changes:
- Introduces 5 new MCP tools under
provar.nitrox.*(discover/read/validate/generate/patch) and registers them in the MCP server. - Adds comprehensive unit tests for NitroX tools and expands smoke coverage; updates/repairs existing unit tests impacted by stricter path policy behavior.
- Updates MCP documentation and guides to describe NitroX capabilities and path-security details; updates
.gitignorefor schema/IP-sensitive files.
Reviewed changes
Copilot reviewed 11 out of 13 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
src/mcp/tools/nitroXTools.ts |
New NitroX tool implementations (discover/read/validate/generate/patch) including validation rules and merge-patch. |
src/mcp/server.ts |
Registers NitroX tools in server startup. |
test/unit/mcp/nitroXTools.test.ts |
New unit tests covering NitroX tools behavior and path policy interactions. |
test/unit/mcp/qualityHubTools.test.ts |
Adds unit tests for Quality Hub failure detection behavior. |
test/unit/mcp/antTools.test.ts |
Updates tests to align with stricter path-policy validation expectations. |
test/unit/mcp/automationTools.test.ts |
Adjusts traversal test to preserve raw .. segments for path-policy enforcement. |
test/unit/mcp/pathPolicy.test.ts |
Minor refactor/clarity change in allowed-dir variable usage. |
scripts/mcp-smoke.cjs |
Extends smoke suite to cover NitroX tools; updates expected tool count. |
docs/mcp.md |
Documents NitroX tools and expands path security section. |
docs/mcp-pilot-guide.md |
Adds NitroX scenario and security-model notes. |
README.md |
Mentions NitroX support in MCP server overview. |
.gitignore |
Ignores NitroX schema artifacts (IP-sensitive). |
yarn.lock |
Lockfile updates (incl. dependency resolution changes). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…sary type assertions - Extract root property checks (NX001/NX002/NX003/NX010) into validateRootProperties() helper to bring validateNitroXContent cyclomatic complexity from 26 to <=20 - Remove redundant 'as string' cast in nitroXTools.test.ts (TypeScript narrows after typeof === 'string' type guard) - Remove redundant 'as string' casts in qualityHubTools.test.ts (same) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.po.jsoncomponent page objects:discover,read,validate,generate,patchNew Tools
provar.nitrox.discovernitroX/directoriesprovar.nitrox.read.po.jsonfiles for AI context/trainingprovar.nitrox.validateprovar.nitrox.generate.po.jsonfrom component descriptionprovar.nitrox.patch.po.jsonNitroX is Provar's Hybrid Model for locators — component-based page objects covering LWC, Screen Flow, Industry Components, Experience Cloud, and HTML5.
Test plan
yarn test:only— 186 unit tests pass across 5 test files (antTools: 68, automationTools: 40, pathPolicy: 8, qualityHubTools: 26, nitroXTools: 44)node scripts/mcp-smoke.cjs 2>/dev/null— all 38 tools PASS (was 33)yarn compile— TypeScript compiles cleanlyprovar.nitrox.discoverwith empty search root returns empty projects, not crashprovar.nitrox.validatewith valid minimal JSON returnsscore: 100Notes
.gitignoreupdated to guardFactComponent.schema.jsonandFactPackage.schema.json(IP-sensitive, not for public repo)TOTAL_EXPECTEDupdated 33 → 38🤖 Generated with Claude Code